package a.a;

import a.c.ab;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.n;
import a.c.w;
import a.i.a.c;
import a.i.db;

public class f
{
  public static int a;
  
  public static void a(a.c.q paramq, n paramn)
  {
    a(paramq, paramn, a.i.q.a(new Double(1.0D)));
  }
  
  public static void a(a.c.q paramq, n paramn, k paramk)
  {
    int m = m.b;
    boolean bool = m.a;
    Object localObject1 = paramq.w();
    do
    {
      do
      {
        if (!((a.c.m)localObject1).e()) {
          break;
        }
        paramn.a(((a.c.m)localObject1).a(), false);
        ((a.c.m)localObject1).f();
      } while (!bool);
    } while (m != 0);
    localObject1 = new boolean[paramq.l()];
    double[] arrayOfDouble1 = new double[paramq.j()];
    double[] arrayOfDouble2 = new double[paramq.j()];
    c localc = new c(paramq);
    Object localObject2 = paramq.v();
    label181:
    label183:
    do
    {
      do
      {
        if (!((w)localObject2).e()) {
          break label272;
        }
        e locale1 = ((w)localObject2).d();
        double d1 = 0.0D;
        double d2 = 0.0D;
        if (bool) {
          break label290;
        }
        d locald2 = locale1.h();
        do
        {
          do
          {
            if (locald2 == null) {
              break;
            }
            d2 += paramk.getDouble(locald2);
            if (m != 0) {
              break label183;
            }
            locald2 = locald2.i();
            if (bool) {
              break label181;
            }
          } while (!bool);
        } while (m != 0);
        locald2 = locale1.i();
        do
        {
          if (locald2 == null) {
            break;
          }
          d1 += paramk.getDouble(locald2);
          locald2 = locald2.j();
          if (m != 0) {
            break label269;
          }
          if (bool) {
            break label267;
          }
        } while (!bool);
        localc.a(locale1, Math.min(d2, d1));
        arrayOfDouble1[locale1.f()] = d2;
        arrayOfDouble2[locale1.f()] = d1;
      } while (m != 0);
      ((w)localObject2).f();
    } while (!bool);
    label267:
    label269:
    label272:
    label282:
    label290:
    label420:
    label638:
    do
    {
      break label638;
      int j;
      e locale2;
      int k;
      do
      {
        if ((m == 0) && (localc.a())) {
          return;
        }
        localObject2 = localc.b();
        int i = ((e)localObject2).f();
        if (arrayOfDouble2[i] >= arrayOfDouble1[i]) {}
        while (m != 0)
        {
          locald1 = ((e)localObject2).h();
          do
          {
            do
            {
              if (locald1 == null) {
                break label420;
              }
              j = locald1.d();
              if (bool) {
                break;
              }
              if (localObject1[j] == 0)
              {
                locale2 = locald1.f();
                k = locale2.f();
                arrayOfDouble2[k] -= paramk.getDouble(locald1);
                paramn.a(locald1, true);
                localc.d(locale2, Math.min(arrayOfDouble2[k], arrayOfDouble1[k]));
                localObject1[j] = 1;
              }
              locald1 = locald1.i();
            } while (!bool);
          } while (m != 0);
          locald1 = ((e)localObject2).i();
          if (locald1 == null) {
            break label272;
          }
          j = locald1.d();
          if (bool) {
            break label282;
          }
          if (localObject1[j] == 0)
          {
            locale2 = locald1.e();
            k = locale2.f();
            arrayOfDouble1[k] -= paramk.getDouble(locald1);
            localc.d(locale2, Math.min(arrayOfDouble2[k], arrayOfDouble1[k]));
            localObject1[j] = 1;
          }
          locald1 = locald1.j();
          if (!bool) {
            break;
          }
        }
        locald1 = ((e)localObject2).h();
        if (locald1 != null) {
          j = locald1.d();
        }
        do
        {
          if (bool) {
            break label282;
          }
          if (localObject1[j] == 0)
          {
            locale2 = locald1.f();
            k = locale2.f();
            arrayOfDouble2[k] -= paramk.getDouble(locald1);
            localc.d(locale2, Math.min(arrayOfDouble2[k], arrayOfDouble1[k]));
            localObject1[j] = 1;
          }
          locald1 = locald1.i();
          if (!bool) {
            break label535;
          }
          if (m != 0) {
            break label537;
          }
          locald1 = ((e)localObject2).i();
          if (locald1 == null) {
            break;
          }
          j = locald1.d();
        } while (m != 0);
      } while (bool);
      if (localObject1[j] == 0)
      {
        locale2 = locald1.e();
        k = locale2.f();
        arrayOfDouble1[k] -= paramk.getDouble(locald1);
        paramn.a(locald1, true);
        localc.d(locale2, Math.min(arrayOfDouble2[k], arrayOfDouble1[k]));
        localObject1[j] = 1;
      }
      d locald1 = locald1.j();
    } while (!bool);
    label535:
    label537:
    return;
  }
  
  public static void b(a.c.q paramq, n paramn)
  {
    int i = m.b;
    boolean bool = m.a;
    int[] arrayOfInt = new int[paramq.j()];
    x.b(paramq, arrayOfInt);
    a.c.m localm = paramq.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      paramn.a(locald, false);
      if (i == 0)
      {
        if (arrayOfInt[locald.e().f()] < arrayOfInt[locald.f().f()]) {
          paramn.a(locald, true);
        }
        localm.f();
      }
    } while (!bool);
  }
  
  public static ab a(a.c.q paramq, boolean paramBoolean)
  {
    ab localab = new ab();
    h local0 = new h()
    {
      boolean l;
      private final ab val$cycle;
      
      protected void a(d paramAnonymousd, e paramAnonymouse, boolean paramAnonymousBoolean)
      {
        int j = m.b;
        boolean bool = m.a;
        if (j == 0)
        {
          if (this.l) {
            return;
          }
          if (j != 0) {}
        }
        else
        {
          if (this.f.get(paramAnonymouse) != h) {
            break label233;
          }
          this.l = true;
        }
        int i = this.val$cycle.size();
        a.c.m localm = this.val$cycle.l();
        localm.i();
        do
        {
          do
          {
            if (!localm.e()) {
              break;
            }
            if (bool) {
              break label193;
            }
            if ((j == 0) && ((localm.a().e() == paramAnonymouse) || ((j == 0) && (localm.a().f() == paramAnonymouse)))) {
              break;
            }
            localm.g();
            i--;
          } while (!bool);
        } while (j != 0);
        if (j == 0)
        {
          if (paramAnonymousd.g())
          {
            if (j != 0) {
              break label213;
            }
            this.val$cycle.clear();
            if (!bool) {}
          }
          else
          {
            i--;
          }
        }
        else if (i <= 0) {}
        label193:
        label213:
        while (j != 0)
        {
          this.val$cycle.b();
          if (j != 0) {
            break label225;
          }
          if (bool) {
            break label223;
          }
          if (!bool) {
            break;
          }
        }
        this.val$cycle.b(paramAnonymousd);
        label223:
        label225:
        if ((j != 0) || (bool)) {
          label233:
          if (paramAnonymousBoolean) {
            this.val$cycle.b(paramAnonymousd);
          }
        }
      }
      
      protected void a(d paramAnonymousd, e paramAnonymouse)
      {
        if ((m.b != 0) || (!this.l)) {
          this.val$cycle.h(this.val$cycle.g());
        }
      }
    };
    local0.a(paramBoolean);
    local0.a(paramq);
    return localab;
  }
  
  public static final ab b(a.c.q paramq, boolean paramBoolean)
  {
    if (paramBoolean) {
      return a(paramq);
    }
    return b(paramq);
  }
  
  static final ab a(a.c.q paramq)
  {
    int i = m.b;
    boolean bool = m.a;
    ab localab = new ab();
    a.c.x localx = db.a(new int[paramq.j()]);
    m.b(paramq, localx);
    a.c.m localm = paramq.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (i == 0)
      {
        if (localx.getInt(locald.e()) == localx.getInt(locald.f())) {
          localab.add(locald);
        }
        localm.f();
      }
    } while (!bool);
    return localab;
  }
  
  static ab b(a.c.q paramq)
  {
    int j = m.b;
    boolean bool = m.a;
    n localn = db.b(new int[paramq.l()]);
    int i = m.a(paramq, localn);
    int[] arrayOfInt = new int[i];
    Object localObject1 = paramq.w();
    do
    {
      if (!((a.c.m)localObject1).e()) {
        break;
      }
      localObject2 = ((a.c.m)localObject1).a();
      if (j == 0)
      {
        if (!((d)localObject2).g()) {
          arrayOfInt[localn.getInt(localObject2)] += 1;
        }
        ((a.c.m)localObject1).f();
      }
    } while (!bool);
    localObject1 = new ab();
    Object localObject2 = paramq.w();
    label168:
    do
    {
      if (!((a.c.m)localObject2).e()) {
        break;
      }
      d locald = ((a.c.m)localObject2).a();
      if (j == 0) {
        if (!locald.g())
        {
          if (j != 0) {
            continue;
          }
          if (arrayOfInt[localn.getInt(locald)] <= 1) {
            break label168;
          }
        }
      }
      ((ab)localObject1).add(locald);
      ((a.c.m)localObject2).f();
    } while (!bool);
    return localObject1;
  }
}


/* Location:           E:\idea\
 * Qualified Name:     a.a.f
 * JD-Core Version:    0.7.0.1
 */